﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UIWindow.Protocols.Fins
{
    public class FinsHandshakePackage : OmRonFinsBase
    {
        /// <summary>
        /// 本机的IP地址最后一位
        /// </summary>
        public byte Address { get; set; }
        public FinsHandshakePackage() : base()
        {

        }
        public override byte[] GetStream()
        {
            //发送数据长度：命令码开始的字节数量
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x0c);

            //命令码
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);

            //错误代码
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);

            //客户端节点地址
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(0x00);
            base._memoryStream.WriteByte(Address);
            return base.GetStream();
        }
    }
}
